package com.macro.mall.portal.controller;

import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.dto.BmsTourismProjectParam;
import com.macro.mall.model.BmsTourismProject;
import com.macro.mall.portal.service.BmsTourismProjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Controller
@Api(tags = "BmsTourismProjectController")
@Tag(name = "BmsTourismProjectController", description = "文旅项目")
@RequestMapping("/tourismProject")
public class BmsTourismProjectController {

    @Autowired
    private BmsTourismProjectService bmsTourismProjectService;

    @ApiOperation("分页查询文旅项目")
    @RequestMapping(value = "/list", method = RequestMethod.POST)
    @ResponseBody
    public CommonResult<CommonPage<BmsTourismProject>> getList(@RequestBody BmsTourismProjectParam bmsTourismProjectParam) {
        List<BmsTourismProject> bmsTourismProjectList = bmsTourismProjectService.getList(bmsTourismProjectParam);
        return CommonResult.success(CommonPage.restPage(bmsTourismProjectList));
    }

    @ApiOperation("根据id获取文旅项目")
    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
    @ResponseBody
    public CommonResult<BmsTourismProject> getItem(@PathVariable Long id) {
        BmsTourismProject bmsTourismProject = bmsTourismProjectService.getItem(id);
        return CommonResult.success(bmsTourismProject);
    }

}
